#ifndef __INCLUDED_CBL_DELEGATE_H__
#error "CBL_ConstDelegate.hpp must not be used directly. Use CBL_Delegate.h instead."
#else
#ifndef __INCLUDED_CBL_CONST_DELEGATE_HPP__
#define __INCLUDED_CBL_CONST_DELEGATE_HPP__

// -------------------------------------------------------------------------------------------------
//	CConstDelegate
// -------------------------------------------------------------------------------------------------

template <typename TClass, void (TClass::*TMethod)() const>
CB_FORCEINLINE CConstDelegate CB_INLINE_ATTR CConstDelegate::Create(const TClass* _pObject)
{
    CConstDelegate Delegate(_pObject);
    Delegate.m_pFunctionPointer = &ObjectFunction<TClass,TMethod>;
    return Delegate;
}

// -------------------------------------------------------------------------------------------------

CB_FORCEINLINE void CB_INLINE_ATTR CConstDelegate::operator()()
{
    m_pFunctionPointer(m_pObject);
}

// -------------------------------------------------------------------------------------------------

template <typename TClass, void (TClass::*TMethod)() const>
CB_FORCEINLINE void CB_INLINE_ATTR CConstDelegate::ObjectFunction(const void* _pObject)
{
    (static_cast<const TClass*>(_pObject)->*TMethod)();
}

// -------------------------------------------------------------------------------------------------
//	CInOutConstDelegate
// -------------------------------------------------------------------------------------------------

template <typename TClass, void (TClass::*TMethod)(void*) const>
CB_FORCEINLINE CInOutConstDelegate CB_INLINE_ATTR CInOutConstDelegate::Create(const TClass* _pObject)
{
    CInOutConstDelegate Delegate(_pObject);
    Delegate.m_pFunctionPointer = &ObjectFunction<TClass,TMethod>;
    return Delegate;
}

// -------------------------------------------------------------------------------------------------

CB_FORCEINLINE void CB_INLINE_ATTR CInOutConstDelegate::operator()(void* _pInOut)
{
	m_pFunctionPointer(m_pObject, _pInOut);
}

// -------------------------------------------------------------------------------------------------

template <typename TClass, void (TClass::*TMethod)(void*) const>
CB_FORCEINLINE void CB_INLINE_ATTR CInOutConstDelegate::ObjectFunction(const void* _pObject, void* _pInOut)
{
    (static_cast<const TClass*>(_pObject)->*TMethod)(_pInOut);
}

#endif
#endif